<!DOCTYPE html>
<html lang="en">
  <head>
    <title>ZiwoSDK  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a title="ZiwoSDK  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">ZiwoSDK 1.0.0 Docs</a> (91% documented)</p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">ZiwoSDK Reference</a>
        <img id="carat" src="img/carat.png" />
        ZiwoSDK  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/Agent.html">Agent</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Call.html">Call</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/RTCClient.html">RTCClient</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/VertoHelpers.html">VertoHelpers</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/VertoWebSocket.html">VertoWebSocket</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ZiwoClient.html">ZiwoClient</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ZiwoSDK.html">ZiwoSDK</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ZiwoWebSocket.html">ZiwoWebSocket</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/RTCMessageType.html">RTCMessageType</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/SocketEvent.html">SocketEvent</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/VertoEvent.html">VertoEvent</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/Defaults.html">Defaults</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/Defaults/Keys.html">– Keys</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/RTCClientDelegate.html">RTCClientDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/RTCMessageBuilderProtocol.html">RTCMessageBuilderProtocol</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/RTCMessageParserProtocol.html">RTCMessageParserProtocol</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/VertoWebSocketDelegate.html">VertoWebSocketDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ZiwoClientDelegate.html">ZiwoClientDelegate</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/RTCAnswerMessage.html">RTCAnswerMessage</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RTCCandidateMessage.html">RTCCandidateMessage</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RTCError.html">RTCError</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RTCMessage.html">RTCMessage</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RTCOfferMessage.html">RTCOfferMessage</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            
            <h1 id='ziwo-sdk' class='heading'>Ziwo SDK</h1>

<p>Our team built a SDK that provides an easy way to integrate Ziwo calls to your iOS app. Written in <strong>Swift 5</strong>, joining <strong>WebSockets</strong>, <strong><a href="https://evoluxbr.github.io/verto-docs/">Verto protocol</a></strong> and <strong><a href="https://webrtc.org/">GoogleRTC</a></strong>, this SDK embed some of the basic features detailed below.</p>
<h2 id='features' class='heading'>Features</h2>

<ul>
<li>[x] Verto authentication</li>
<li>[x] Call agent or external number</li>
<li>[x] Receive call from agent or external number</li>
<li>[x] Mute microphone during a call</li>
<li>[x] Set audio source to speaker during a call</li>
<li>[x] Hold / Unhold a ongoing call</li>
</ul>
<h2 id='requirements' class='heading'>Requirements</h2>

<ul>
<li>iOS 10.0+</li>
<li>Xcode 11+</li>
<li>Swift 5.1+</li>
</ul>
<h2 id='installation' class='heading'>Installation</h2>

<p>Use <a href="https://guides.cocoapods.org/using/getting-started.html">Cocoapods</a> to add the SDK to your app.</p>
<pre class="highlight shell"><code>pod <span class="s1">'ZiwoSDK'</span>
</code></pre>
<h2 id='initialization' class='heading'>Initialization</h2>

<p>In order to setup the Ziwo SDK and the Verto protocol, follow the steps below.</p>

<ol>
<li><strong>Set the domain</strong>.</li>
</ol>
<pre class="highlight swift"><code><span class="kt">ZiwoSDK</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="n">domain</span> <span class="o">=</span> <span class="s">"test-domain.aswat.co"</span>
</code></pre>

<ol>
<li>Once the agent is logged on Ziwo (<code>.POST /auth/login</code>), <strong>set the access token</strong> returned by the request.</li>
</ol>
<pre class="highlight swift"><code><span class="kt">ZiwoSDK</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="n">accessToken</span> <span class="o">=</span> <span class="n">accessToken</span>
</code></pre>

<ol>
<li><p>Notify Ziwo that the agent is connected and available (<code>.POST /agents/autoLogin</code>).</p></li>
<li><p>Whenever you get the agent datas (<code>.GET /profile</code>), <strong>set the logged agent</strong>.</p></li>
</ol>
<pre class="highlight swift"><code><span class="kt">ZiwoSDK</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">setAgent</span><span class="p">(</span><span class="nv">agent</span><span class="p">:</span> <span class="n">agent</span><span class="p">)</span>
</code></pre>

<ol>
<li>Finally, <strong>initialize the Ziwo Client</strong>.</li>
</ol>
<pre class="highlight swift"><code><span class="k">self</span><span class="o">.</span><span class="n">ziwoClient</span><span class="o">.</span><span class="nf">initializeClient</span><span class="p">()</span>
<span class="k">self</span><span class="o">.</span><span class="n">ziwoClient</span><span class="o">.</span><span class="n">delegate</span> <span class="o">=</span> <span class="k">self</span>
</code></pre>

<p>Et voilà! ZiwoSDK is fully initialized and is now able to make and receive calls. (see <code><a href="Protocols/ZiwoClientDelegate.html">ZiwoClientDelegate</a></code> methods).
The SDK is currently logging a lot of informations about the websocket and Verto protocol communication.
If you want to deactivate the debug mode, set the <code>vertoDebug</code> boolean to <code>false</code>.</p>
<h2 id='example' class='heading'>Example</h2>

<p>For further informations about the implementation, you can check the <a href="https://github.com/ASWATFZLLC/ziwo-sdk-ios/tree/master/ZiwoExampleApp">example app available</a>.
Please check the documentation of <code><a href="Classes/ZiwoClient.html">ZiwoClient</a></code> and its delegates (ZiwoClientDelegate).</p>

<ul>
<li><strong>To make a call</strong></li>
</ul>
<pre class="highlight swift"><code><span class="k">self</span><span class="o">.</span><span class="n">ziwoClient</span><span class="o">.</span><span class="nf">call</span><span class="p">(</span><span class="nv">number</span><span class="p">:</span> <span class="s">"+33XXXXXXXXX"</span><span class="p">)</span>
</code></pre>

<ul>
<li><strong>To receive a call</strong></li>
</ul>

<p>Link the delegate <code><a href="Protocols/ZiwoClientDelegate.html">ZiwoClientDelegate</a></code> to your controller. Whenever someone will call <code>ZiwoClientDelegate.vertoReceivedCall(callerID: String)</code> will be triggered.
At any moment, you&rsquo;ll be able to retrieve the informations about the call by calling <code>ZiwoClient.findCall(callID: String)</code>.</p>
<h2 id='getting-help' class='heading'>Getting Help</h2>

<ul>
<li><strong>Have a bug to report?</strong> <a href="https://github.com/ASWATFZLLC/ziwo-sdk-ios/issues">Open a GitHub issue</a>. If possible, include the version of ZiwoSDK, a full log, and a project that shows the issue.</li>
<li><strong>Have a feature request?</strong> <a href="https://github.com/ASWATFZLLC/ziwo-sdk-ios/issues">Open a GitHub issue</a>. Tell us what the feature should do and why you want the feature.</li>
</ul>
<h2 id='contributing' class='heading'>Contributing</h2>

<p>Pull requests are welcome. For major changes, <a href="https://github.com/ASWATFZLLC/ziwo-sdk-ios/issues">please open an issue</a> first to discuss what you would like to change.</p>
<h2 id='license' class='heading'>License</h2>

<p>ZiwoSDK is released under the GNU GPVL3 license. See <a href="https://github.com/ASWATFZLLC/ziwo-sdk-ios/blob/master/LICENSE">LICENSE</a> for details.</p>

          </section>
        </section>
        <section id="footer">
          <p>&copy; 2020 <a class="link" href="https://github.com/ASWATFZLLC/ziwo-sdk-ios" target="_blank" rel="external">Emilien Roussel</a>. All rights reserved. (Last updated: 2020-05-14)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
